<?php

class Smarty_extended extends Smarty{
	/**
    * The path from default view to override view.
    *
    * @var string
    */
   var $override_path = '../../content/override_view/';
	/**
	* OVERRIDE of fetch function : it takes care about overrride views
	*
	* @param string $resource_name
	* @param string $cache_id
	* @param string $compile_id
	* @param boolean $display
	*/
	function fetch($resource_name, $cache_id = null, $compile_id = null, $display = false) {
		if (file_exists(_kmm_view_dir_.'/'.$this->override_path.$resource_name))
			$resource_name = _kmm_view_dir_.'/'.$this->override_path.$resource_name;
		return parent::fetch($resource_name, $cache_id, $compile_id, $display);
	}
}

/* smarty config */
$smarty = new Smarty_extended;
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->caching 		= false;
$smarty->force_compile	= true;
$smarty->template_dir 	= _kmm_view_dir_;
$smarty->debug_tpl		= $smarty->template_dir.'/smarty_debug.tpl';
$smarty->compile_dir 	= _kmm_content_dir_ .'/compile/smarty_compile';
$smarty->cache_dir 		= _kmm_content_dir_ .'/compile/smarty_cache';
$smarty->caching 		= false;
$smarty->force_compile	= false;


$smarty->register_function('_p','_p');
$smarty->register_function('_d','_d');
$smarty->register_function('_dir_to_uri','_dir_to_uri');
$smarty->register_function('_uri_to_dir','_uri_to_dir');
$smarty->register_function('getHumanId3Tag','getHumanId3Tag');
$smarty->register_function('wash','wash');
$smarty->assign(array(
	'base_dir' =>			_kmm_base_dir_,
	'base_uri' =>			_kmm_base_uri_,
	'core_uri' =>			_kmm_core_uri_,
	'content_uri' =>			_kmm_content_uri_,
	'css_uri' =>			_kmm_css_uri_,
	'img_uri' =>			_kmm_img_uri_,
	'fff_uri' =>			_kmm_fff_uri_,
	'js_uri' =>			_kmm_js_uri_,
	'jquery_uri' =>			_kmm_jquery_uri_,
	'path_from_base' =>	_kmm_music_dir_ . '/',
	'lang_iso' =>			'fr'
));
